home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 52 - My Disc
/
Volume 52 My Disc - Damaged.iso
/
Games
/
rushhour.swf
/
scripts
/
__Packages
/
Car1.as
< prev
next >
Wrap
Text File
|
2007-10-01
|
3KB
|
87 lines
class Car1 extends Vehicle
{
var cartype = "car1";
var size = [0,1];
function Car1()
{
super();
}
function onPress()
{
var _loc3_ = this._parent.possibleMoves(this);
if(this.cartype == "playercar" && _loc3_[1][1] == 5)
{
_loc3_[1][1] = 6;
}
var min_x = this.getPossibleX(_loc3_[0]);
var max_x = this.getPossibleX(_loc3_[1]) - this.spacing * this.size[1];
var mousehelper = this._xmouse;
this.onEnterFrame = function()
{
var _loc2_ = undefined;
if(this._parent._xmouse - mousehelper >= min_x && this._parent._xmouse - mousehelper <= max_x)
{
_loc2_ = this._parent._xmouse - this._x - mousehelper;
}
else if(this._parent._xmouse - mousehelper < min_x)
{
_loc2_ = min_x - this._x;
}
else if(this._parent._xmouse - mousehelper > max_x)
{
_loc2_ = max_x - this._x;
}
var _loc3_ = _loc2_ / 2;
var _loc4_ = Math.round(((this._x + _loc2_) / this.spacing - 2 * (this._y + _loc3_) / this.spacing) / 2);
this._x += _loc2_;
this._y -= _loc3_;
this.moveChildren(_loc2_,_loc3_);
this.adjustDepth();
this.ypos = _loc4_;
};
}
function adjustDepth()
{
_root.adjustDepth(this);
var _loc3_ = 1;
while(_loc3_ <= this.size[0])
{
_root.adjustDepth(this["child" + _loc3_]);
_loc3_ = _loc3_ + 1;
}
}
function moveChildren(xmove, ymove)
{
var _loc3_ = 1;
while(_loc3_ <= this.size[1])
{
this["child" + _loc3_]._x += xmove;
this["child" + _loc3_]._y -= ymove;
_root.adjustDepth(this["child" + _loc3_]);
_loc3_ = _loc3_ + 1;
}
}
function onRelease()
{
super.onRelease();
var _loc4_ = 1;
while(_loc4_ <= this.size[1])
{
this["child" + _loc4_]._x = this.spacing * (this.xpos + this.ypos + _loc4_);
this["child" + _loc4_]._y = this.spacing / 2 * (this.xpos - this.ypos - _loc4_);
_root.adjustDepth(this["child" + _loc4_]);
_loc4_ = _loc4_ + 1;
}
}
function onUnload()
{
var _loc2_ = 1;
while(_loc2_ <= this.size[1])
{
this["child" + _loc2_].swapDepths(100000);
this["child" + _loc2_].removeMovieClip();
_loc2_ = _loc2_ + 1;
}
}
}